<!DOCTYPE html>
<html>

	<head>
		<meta charset="UTF-8">
		<title>数组的定义与使用</title>
	</head>

	<body>
		<script>
			//数组定义（数组的长度动态调整）,数据类型不受限制，不建议
			var a = new Array();
			a[0] = 4;
			a[1] = 5;

			//数组定义2
			var a2 = Array("a", "b", "c");
			a2[5] = "g";

			//数组定义3
			var a3 = ["java", "mysql", "javascript"];
			a3[2] = "c";

			//			console.log(a2[4]);
			//			console.log(a3[2]);
			//			console.log(a2.length);
			//			console.log(a3[2]);
			console.log("数组a2的元素")		

			//遍历数组
			for(var i = 0; i < a2.length; i++) {
				console.log(a2[i]);
			}
		</script>
	</body>

</html>